<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue入门指南-响应式基础</title>
    <link rel="stylesheet" href="comm.css">

    <script type="importmap">
        {
            "imports":{
                "vue":"https://lib.baomitu.com/vue/latest/vue.esm-browsesr.js"
            }
        }
    </script>
</head>
<body>
    <div id="app"><p><button v-on:click="increment">{{count}}</button>
        <button v-on:click="testThis">不要使用箭头函数</button><p></div>
    <script type="moudle">
        import {createApp} from "vue";
        createApp({
            data(){
                return{
                    count:0,
                };
            },
            methods:{
                increment(){
                    console.log(this);
                    this.count++;
                },
                testThis:=>{
                    console.log(this);
                }
            },
            mounted(){
                console.log(`${this.$data.count}`);
                this.count=2;
            }
        }).mount("#app");
    </script>
    
</body>
</html>